<template>
<div class="zone-wrapper">
  <div class="zone-content">
    <zone-topic-header name="数据专区" en-name="Zone management"  @more="toList" show-more ></zone-topic-header>
    <div class="imgNoc" v-if="carouselList.length<4">
      <div class="img" v-for="(item,index) in carouselList" @click="bannerOpen(item)" :key="index">
        <div class="imgsrc" :style="{backgroundImage:'url('+item.fileUrl+')'}">
          <div class="zone-name">{{item.name}}</div>
          <!-- <div class="zone-note">{{item.note}}</div> -->
        </div>
      </div>
    </div>
    <a-carousel v-else class="carousel" arrows autoplay :dots="false" :slides-to-show="4" :slides-to-scroll="1" :autoplaySpeed="1000" :speed="5000" >
      <div slot="prevArrow" slot-scope="props" class="custom-slick-arrow" style="left: 10px;z-index: 1;" >
        <a-icon type="left-circle"/>
      </div>
      <div slot="nextArrow" slot-scope="props" class="custom-slick-arrow" style="right: 10px;" >
        <a-icon type="right-circle"/>
      </div>
      <div class="img" v-for="(item,index) in carouselList" @click="bannerOpen(item)" :key="index">
        <div class="imgsrc" :style="{backgroundImage:'url('+item.fileUrl+')'}">
          <div class="zone-name">{{item.name}}</div>
          <!-- <div class="zone-note">{{item.note}}</div> -->
        </div>
      </div>
    </a-carousel>
  </div>
</div>

</template>

<script>
import ZoneTopicHeader from './ZoneTopicHeader'
export default {
  name: 'ZoneBanner',
  components: {
    ZoneTopicHeader
  },
  props: {
    carouselList: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    bannerOpen (item) {
      this.$emit('open', item)
    },
    toList () {
      this.$router.push({
        path: '/zoneList'
      })
    }
  }
}
</script>

<style scoped lang="scss">
.zone-wrapper {
  width: 100%;
  background-image: linear-gradient(to right, #EAF5FF, #FCFDFF);
  height: 300px;
  background-position: top;
  .zone-content {
    width: 1200px;
    margin: auto;
  }
}

.container {
  height: 240px;
  width: 100%;
}

.carousel {
  width: 100%;
  height: 240px;
}
.imgNoc{
  margin-top: 20px;
  width: 100%;
  height: 240px;
  display: flex;
  .img{
    width: 270px;
    margin-right: 30px;
  }
}
.img {
  width: 100%;
  height: 240px;
  .imgsrc{
    border-radius: 10px;
    width: 270px;
    height: 100%;
    background-size: cover;
    margin: 0 auto;
  }
}
.zone-name {
  padding: 74px 0 4px;
  font-size: 30px;
  letter-spacing: 2px;
  // padding: 100px 0 4px;
  // font-size: 24px;
  font-family: Source Han Sans CN,Microsoft YaHei;
  text-align: center;
  color: #fff;
  font-weight: 900;
}
.zone-note {
  font-size: 13px;
  margin: 0 20px;
  font-family: Source Han Sans CN,Microsoft YaHei;
  text-align: center;
  color: #fff;
  font-weight: 300;
}

.ant-carousel {
  /deep/ .slick-slide {
    border: 0px solid #e2e2e2;
    border-radius: 10px;
    height: 240px;
    overflow: hidden;
  }
  /deep/ .slick-slider {
    margin: 20px 0;
    height: 240px;
    overflow: hidden;
  }
  /deep/ .slick-list{
    height: 280px;
  }

  /deep/ .custom-slick-arrow {
    width: 25px;
    height: 25px;
    font-size: 25px;
    color: #fff;
    border-radius: 50%;
    background-color: rgba(31, 45, 61, 0.11);
    opacity: 0.3;
  }

  /deep/ .custom-slick-arrow:before {
    display: none;
  }

  /deep/ .custom-slick-arrow:hover {
    opacity: 0.5;
  }
}
</style>
